xx <- c(-7,-5,-4,-3,-1,3,4,4,7,9)
yy <- c(4,1,0,-2,-3,9,8,4,0,-6)
cor(xx,yy)
plot(xx,yy, col="black",bg="black", pch=21, cex=1.5)
grid()
beta <- (mean(xx*yy) - mean(xx)*mean(yy))/(mean(xx*xx) - (mean(xx))*(mean(xx)))
alpha <- mean(yy) - beta*mean(xx)
z <- seq(-5,5,by=0.1)
points(z,beta*z+alpha,col="red", type="l")